﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Mytrip.Users.mytrip_Roles>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	IndexRole
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2 style="position: relative; float: right"><%= Html.ActionLink("All users", "Index")%></h2>
    <h2>All roles</h2>
    <%=Html.MytripPager(10, (int)ViewData["total"],"...")%>
    <table style="width: 100%;">
    <tr>
     <th style="text-align: right; width: 50%;">
    <% using (Html.BeginForm("CreateRole", "Admin"))
       { %>           
               
                    <%= Html.TextBox("RoleName") %>
                    <%= Html.ValidationMessage("RoleName")%>
                
                    <input type="submit" value="Add role" />                
            
    <% } %>
    </th>
   <th style="text-align: right">
   <% using (Html.BeginForm())
   { %> <%= Html.TextBox("search")%>
    <input type="submit" value="Search role" />
<%} %></th></tr>
   
    </table>
    <table style="width: 100%;">
        <tr>
            <th style="width: 50px;"></th>
            <th>
                <%= Html.ActionLink("Role Name", "IndexRole", new { id = 1, id2 = 10, id3 = Html.MytripSort("RoleName") })%>
            </th>
            <th>
                <%= Html.ActionLink("Users Count", "IndexRole", new { id = 1, id2 = 10, id3 = Html.MytripSort("UserCount") })%>
            </th>
        </tr>

    <% foreach (var item in Model) { %>
    
        <tr>
            <td><img src="/content/images/Keys.png" alt="Details" style="border-width: 0px; width: 20px;" />
                            <a href="<%=Url.Action("DeleteRole", new {  id =item.RoleName })%>" onclick="return confirm ('Are you sure?');">
                                <img src="/content/images/delete.png" alt="Delete" style="border-width: 0px; width: 20px;" /></a>
            </td>
            <td>
                <%= Html.Encode(item.RoleName) %>
            </td>
            <td>
                <%= Html.Encode(item.mytrip_Users.Count()) %>
            </td>
        </tr>
    
    <% } %>

    </table>
<%=Html.MytripPager(10, (int)ViewData["total"],"...")%>
</asp:Content>

